<template>
	<view class="container">
		<cu-custom isBack isFixed bgColor="bg-white">
			<block slot="content">意见反馈</block>
		</cu-custom>
		<form class="form" @submit="submit" 
			:style="{ paddingTop: CustomBar + 'px' }">
			<view class="title">
				问题或意见
			</view>
			<textarea class="input-area" name="doubt" 
				placeholder="您提交的反馈将同步到我们的CEO邮箱，我们的工作人员会及时处理，感谢您的宝贵意见！"/>
			<view class="title">
				联系方式
			</view>
			<input class="input-view" type="text" name="email" 
				placeholder="请输入您的联系方式，接收反馈结果"/>
			<view class="flex justify-center">
				<button class="cu-btn submit-btn lg" form-type="submit">确认提交</button>
			</view>
		</form>
	</view>
</template>

<script>
	import { BASE_URL, postAdv } from '@/common/api/auth.js'
	export default {
		data() {
			return {
				CustomBar: this.CustomBar,
				baseUrl: BASE_URL
			}
		},
		methods: {
			submit(e) {
				console.log(e)
				let params = {
					content: e.detail.value.doubt,
					mobile: e.detail.value.email
				}
				postAdv(params).then(res => {
					if(res&&res.code == 1) {
						this.$tools.msg("感谢您的反馈")
						setTimeout(() => {
							this.$tools.back()
						}, 500)						
					}
				})
			}
		}
	}
</script>

<style scoped>
	.form {
		display: block;
		padding-left: 30rpx;
		padding-right: 30rpx;
	}
	.title {
		font-size: 32rpx;
		height: 90rpx;
		line-height: 90rpx;
	}
	.input-area {
		width: 100%;
		height: 360rpx;
		border-radius: 10rpx;
		padding: 20rpx;
		background-color: #fff;
		font-size: 28rpx;
	}
	.input-view {
		background-color: #fff;
		height: 72rpx;
		line-height: 72rpx;
		border-radius: 10rpx;
		padding: 0 20rpx;
		font-size: 28rpx;
	}
	.submit-btn {
		background-color: rgb(0, 123, 70);
		color: #fff;
		border-radius: 999999rpx;
		width: 520rpx;
		margin-top: 60rpx;
	}
</style>